package pingan.com.imandtwo.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import chendemin.bwei.com.myapplication.gen.DbBeanDao;
import pingan.com.imandtwo.R;
import pingan.com.imandtwo.adapter.AddFriendAdapter;
import pingan.com.imandtwo.db.DbBean;
import pingan.com.imandtwo.db.DbUtils;
import pingan.com.imandtwo.utils.BaseActivity;

public class AddFriendActivity extends BaseActivity {


    @BindView(R.id.tv)
    RecyclerView recycler;
    private DbBeanDao dbDao;
    private Unbinder bind;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_friend);
        bind = ButterKnife.bind(this);

        LinearLayoutManager manager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        recycler.setLayoutManager(manager);


        dbDao = DbUtils.getSingleton().getDbDao(this);

        List<DbBean> dbBeen = dbDao.loadAll();
        AddFriendAdapter addFriendAdapter = new AddFriendAdapter(dbBeen, AddFriendActivity.this);
        recycler.setAdapter(addFriendAdapter);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        bind.unbind();
    }
}
